package cn.gyxy.controller;

import cn.gyxy.mapper.LoginMapper;
import cn.gyxy.pojo.Guanli;
import cn.gyxy.service.GuanliService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;
@Controller
@RequestMapping("/lgbs")
public class GuanliController {
    @Autowired
    private GuanliService guanliService;
    @Autowired
    private LoginMapper loginMapper;
@RequestMapping("/guanlichaxun")
public  String  guanliChaxun(Model model){
    List<Guanli>  guanlilist=guanliService.guanliChaxun();
    model.addAttribute("guanlilist",guanlilist);

    return "guanli-chaxun";
}
//    @RequiresPermissions("1")
@RequestMapping("/DeleteByIdguanli/{id}")
public  String DeleteByIdguanli(@PathVariable Integer id){
    guanliService.DeleteByIdguanli(id);

    return "redirect:/lgbs/guanlichaxun";
}

    @RequestMapping("/guanliAddUI")
    public  String  guanliAddUI(){
        return "guanli-Add";
    }


//    @RequiresPermissions("1")
@RequestMapping("/guanliAdd")
public  String guanliAdd( Guanli guanli){
    guanliService.guanliAdd(guanli);
    return "fanhui";
}

//进入密码修改页面
@RequestMapping("/guanlimima")
public  String guannimima(){

   return "guanli-mima";
}
@RequestMapping("/guanlimimaUI")
public  String guanlimimaUI(Guanli guanli){
    guanliService.guanlimima(guanli);
    return "fanhui";
}


}
